from pyecharts import options as opts
from pyecharts.charts import Bar
import random

l1 = ['{}日'.format(i) for i in range(1, 31)]
l2 = [random.choice(range(100, 3100, 100)) for i in range(1, 31)]
bar = (
    Bar()
        .add_xaxis(l1)
        .add_yaxis("l2", l2)
        .set_global_opts(title_opts=opts.TitleOpts(title="区域缩放柱状图"),
                         datazoom_opts=opts.DataZoomOpts(type_="slider"))
)
bar.render(path='8.横坐标缩放-区域缩放.html')
